<?php

/**
 * ygmPerAssignment actions.
 *
 * @package    ControleCredencial
 * @subpackage ygmPerAssignment
 * @author     Yuri Marques <yurigmarques@gmail.com>
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class ygmPerAssignmentComponents extends sfComponents {

    public function executeListpermissios() {

        $this->modules = Doctrine_Core::getTable('ygmPerModule')->findAll();
        if ($this->idUser) {
            $this->permissions = Doctrine_Query::create()
                            ->select('permission_id')
                            ->from('sfGuardUserPermission')
                            ->where('user_id = ?', $this->idUser)->fetchArray();
            $this->id_ori_nome = 'user_id';
            $this->id_ori = $this->idUser;
        } elseif ($this->idGroup) {
            $this->permissions = Doctrine_Query::create()
                            ->select('permission_id')
                            ->from('sfGuardGroupPermission')
                            ->where('group_id = ?', $this->idGroup)->fetchArray();
            $this->id_ori_nome = 'group_id';
            $this->id_ori = $this->idGroup;
        } else {
            $this->permissions = array();
            $this->id_ori_nome = '';
            $this->id_ori = '';
        }
    }

}

?>
